from django.core.management.base import BaseCommand, CommandError
from lotto.service.update import parse

class Command (BaseCommand):
    args = '<name name ...>'
    help = 'Update the specified Lotto game.'

    def handle(self, *args, **options):
        for l in args:
            try:
                parse (l);
            except ValueError:
                raise CommandError ("Available values: <lotto, mini, multi, kaskada, joker>")
            except:
                raise CommandError ('Problem with update "%s"' % l);
            self.stdout.write ('Successfully update "%s"\n' % l);

